package org.spamforces.model;

import com.codeforces.commons.text.StringUtil;
import com.codeforces.commons.time.TimeUtil;

import java.util.Date;

/**
 * @author IvanPopelyshev (ivan.popelyshev@gmail.com)
 */
public class Email extends ApplicationEntity {
    private long broadcastId;
    private String targetEmail;
    private String fromEmail;
    private String subject;
    private String body;
    private Date sentTime;
    private String headers;
    private Status status;

    public void setBroadcastId(long broadcastId) {
        this.broadcastId = broadcastId;
    }

    public long getBroadcastId() {
        return broadcastId;
    }

    public void setTargetEmail(String targetEmail) {
        this.targetEmail = targetEmail;
    }

    public String getTargetEmail() {
        return targetEmail;
    }

    public void setFromEmail(String fromEmail) {
        this.fromEmail = fromEmail;
    }

    public String getFromEmail() {
        return fromEmail;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String getSubject() {
        return subject;
    }

    public void setBody(String body) {
        this.body = body;
    }

    public String getBody() {
        return body;
    }

    public void setSentTime(Date sentTime) {
        this.sentTime = TimeUtil.toDate(sentTime);
    }

    public Date getSentTime() {
        return TimeUtil.toDate(sentTime);
    }

    public void setHeaders(String headers) {
        this.headers = headers;
    }

    public String getHeaders() {
        return headers;
    }

    public void setStatus(Status status) {
        this.status = status;
    }

    public Status getStatus() {
        return status;
    }

    @Override
    public String toString() {
        return StringUtil.toString(this, false, "broadcastId", "targetEmail", "fromEmail", "status");
    }
}
